// 创建唯一store
import { createStore, applyMiddleware } from 'redux'
import logger from 'redux-logger'
import thunk from 'redux-thunk'
import reducer from './reducer'
// 持久化
import {persistStore,persistReducer} from 'redux-persist'
import storage from 'redux-persist/lib/storage'

// 对redcer进行持久化处理
const persistedReducer=persistReducer({key:'root',storage},reducer)

// 创建唯一的store
let store=createStore(persistedReducer,applyMiddleware(thunk,logger))
// 对唯一的store进行持久化处理
let persistor=persistStore(store)

// export default createStore(reducer, applyMiddleware(thunk,logger))

export {
    store,
    persistor
}